/*
 * Company  : Datalogic S.p.A.
 * Title    : LIBRARY INPUT OUTPUT GENERAL CONSTANTS
 * Filename : IOGENK.INC
 * System   : Keil-Frankling C-Language Compiler
 * MemoryMod: large
 * Notes    :
 */


/* bankset() function parameters; application allows from SEL_RAMB1 to SEL_RAMB63 */

#define SEL_NONE           4 // Do not use bankset(SEL_NONE).
#define SEL_OFFSET         4 // Do not use bankset(SEL_OFFSET).



#define SEL_RAMB1          5
#define SEL_RAMB2          6
#define SEL_RAMB3          7
#define SEL_RAMB4          8
#define SEL_RAMB5          9
#define SEL_RAMB6         10
#define SEL_RAMB7         11
#define SEL_RAMB8         12
#define SEL_RAMB9         13
#define SEL_RAMB10        14
#define SEL_RAMB11        15
#define SEL_RAMB12        16
#define SEL_RAMB13        17
#define SEL_RAMB14        18
#define SEL_RAMB15        19
#define SEL_RAMB16        20
#define SEL_RAMB17        21
#define SEL_RAMB18        22
#define SEL_RAMB19        23
#define SEL_RAMB20        24
#define SEL_RAMB21        25
#define SEL_RAMB22        26
#define SEL_RAMB23        27
#define SEL_RAMB24        28
#define SEL_RAMB25        29
#define SEL_RAMB26        30
#define SEL_RAMB27        31
#define SEL_RAMB28        32
#define SEL_RAMB29        33
#define SEL_RAMB30        34
#define SEL_RAMB31        35
#define SEL_RAMB32        36
#define SEL_RAMB33        37
#define SEL_RAMB34        38
#define SEL_RAMB35        39
#define SEL_RAMB36        40
#define SEL_RAMB37        41
#define SEL_RAMB38        42
#define SEL_RAMB39        43
#define SEL_RAMB40        44
#define SEL_RAMB41        45
#define SEL_RAMB42        46
#define SEL_RAMB43        47
#define SEL_RAMB44        48
#define SEL_RAMB45        49
#define SEL_RAMB46        50
#define SEL_RAMB47        51
#define SEL_RAMB48        52
#define SEL_RAMB49        53
#define SEL_RAMB50        54
#define SEL_RAMB51        55
#define SEL_RAMB52        56
#define SEL_RAMB53        57
#define SEL_RAMB54        58
#define SEL_RAMB55        59
#define SEL_RAMB56        60
#define SEL_RAMB57        61
#define SEL_RAMB58        62
#define SEL_RAMB59        63
#define SEL_RAMB60        64
#define SEL_RAMB61        65
#define SEL_RAMB62        66
#define SEL_RAMB63        67

/* Configuration ram type */

#define RAM128K_CNF        SEL_RAMB3 + 1
#define RAM512K_CNF        SEL_RAMB14+ 1 //VVIC
#define SWB_RAM_CONFIG     RAM1024K_CNF
#define RAM1024K_CNF       SEL_RAMB31+ 1
#define RAM1536K_CNF       SEL_RAMB47+ 1  /* not used */
#define RAM2048K_CNF       SEL_RAMB63+ 1

/* setcom() function parameters */

#define B600		0x0
#define	B1200		0x1
#define B2400		0x2
#define	B4800		0x3

#define B9600		0x4
#define B19200      	0x5
//#define B28800        	0x6
#define B38400        	0x6
#define B57600        	0x7
#define B115200      	0x8

#define ERRBAUD        B115200+1

#define DEFBAUD        B9600

#define PODD           0x00
#define PEVEN          0x01
#define PMARK          0x02
#define PSPACE         0x03
#define PNONE          0x04
#define ERRPARITY      PNONE+1

#define DEFPARITY      PEVEN

#define X7BITS         0x00
#define X8BITS         0x01
#define ERRBITS        X8BITS+1

#define DEFBITS        X7BITS

#define BADPARITY      0x01      /* setcom() function error code */


/* led( unsigned char ) function parameters */

#define OFFLEDS        0x00
#define ONREDLD        0x01
#define ONGRELD        0x02
#define ONYELLD        0x03
#define ERRLEDS        0x04


#define ONBLUELD		0X05
#define OFFBLUELD		0X06
#define  ERRLED 	    0X07

/* contrast( unsigned char ) function parameters */

#define DEFAULT_CONTRAST  0X80
#define CURRENT_CONTRAST  0X81
#define RAM1024_CNF       SEL_RAMB30+ 1

/* icon_on function parameters */
/* ICON POSITION */

#define 	ICON_FIRST		1
#define 	ICON_SECOND		2
#define 	ICON_THIRD		3
#define 	ICON_FOURTH		4

/* ICON TYPE */

#define 	ICON_LOCKEDKEY		1
#define 	ICON_BT				2
#define		ICON_USB			3
#define 	ICON_MMCSD			4

#define 	ICON_MAIL			5
#define 	ICON_BELL			6
#define 	ICON_PHONE			7

//#define		FIRST_ICON_START_ADDR	18
//#define 	FIRST_ICON_START_ADDR	31
//#define		FIRST_ICON_START_ADDR	44
//#define		FIRST_ICON_START_ADDR	57

#define 	ICON_ARRAY_SIZE			12

//bluetooth
//Baud Rate

#define BAUD_1200  		0x01
#define BAUD_2400  		0x02
#define BAUD_4800  		0x03
#define BAUD_9600  		0x04
#define BAUD_19200 		0x05
#define BAUD_38400 		0x06
#define BAUD_57600 		0x07
#define BAUD_115200		0x08
//Stop bit
#define EX_UARTSTOPBIT1	1
#define EX_UARTSTOPBIT2	2

#define BT_STOPBIT1	1
#define BT_STOPBIT2	2

//Parity

#define EX_UARTEVENPARITY	1
#define EX_UARTODDPARITY	2
#define EX_UARTNOPARITY		3


#define BT_EVENPARITY	1
#define BT_ODDPARITY	2
#define BT_NOPARITY		3


#define BT_TIMEOUT		1000
#define TIMEOUT_550		6000
#define BT_BUF_SIZE 	60

#define CONNECTED 		1
#define NOTCONNECTED 	0

#define BTOFF			0x00
#define BTON  			0x01

//#define BT_BUF_SIZE 	0

//Device Role
#define BT_MASTER 	'0'
#define BT_SLAVE  	'1'
#define BT_MASTER_SLAVE 	'2'

#define BT_CONNECTION_OFF_DISCOVERY_OFF	  '0'
#define BT_CONNECTION_OFF_DISCOVERY_ON	  '1'
#define BT_CONNECTION_ON_DISCOVERY_OFF	  '2'
#define BT_CONNECTION_ON_DISCOVERY_ON	  '3'

#define BT_START_CALL 	'1'
#define BT_WAIT_SPECIFIC_CALL	'2'
#define BT_WAIT_CALL	'3'


#define WAIT_TIMEOUT  60000
#define WAIT1_TIMEOUT  20000
#define CFG_OK		1
#define DNAME_ERR	3
#define DROLE_ERR	4
#define TPIN_ERR	5
#define SMODE_ERR	6
#define DEVICE_NAME		1
#define DEVICE_ROLE	  	2
#define PIN		  		3
#define SCAN_MODE		4
#define CALL_MODE	 	5
#define REMOTE_ADDRESS	6
#define PWR_DOWN_STATUS	7


// bluetooth constants.

#define 	MAX_WAIT_CNT			100
#define 	TX_CH_MAX_CNT			10
#define		MAX_BUFFER_SIZE			40
#define 	MCR_CONTROL_WORD		0x22
#define 	MCR_CLR_RTS				~0x02
#define 	LSR_TxHRE_BIT			0x20
#define 	RTS_DR_BIT				0x01
#define 	LCR_STB_BIT				0x04
#define 	LCR_EVEN_PAR_WORD		0x18
#define 	LCR_ODD_PAR_WORD		0x08
#define 	LCR_PAR_EN_WORD			0x08
#define 	MCR_SET_DTR_BIT			0x01

#define 	CSR3_BUS_BT_nWLAN_LED		 	0x01
#define 	CSR3_BUS_BT_BT_PWR_EN			0x02
#define 	CSR3_BUS_BT_EXT_UART_RST		0x08
#define 	CSR3_BUS_BT_nBT_RESET			0x80
#define 	CSR3_BUS_BT_nLED				0x40

#define 	MSK_CSR3_BUS_BT_nWLAN_LED		 	~0x01
#define 	MSK_CSR3_BUS_BT_BT_PWR_EN			~0x02
#define 	MSK_CSR3_BUS_BT_EXT_UART_RST		~0x08
#define 	MSK_CSR3_BUS_BT_nBT_RESET			~0x80
#define 	MSK_CSR3_BUS_BT_nLED				~0x40

#define 	CR_START		0
#define 	LF_START		1
#define 	RCVD_STRING		2
#define 	CR_END			3

#define     ICON_ROW       0xff